<template>
  <view class="mine-infoitem-page">
    <view class="mine-infoitem-content">
      <view class="mine-infoitem-flex">
        <view>税号</view>
        <view>{{ billInfo.taxNum }}</view>
      </view>
      <view class="mine-infoitem-flex">
        <view>是否含税采购</view>
        <view>{{ billInfo.taxIncludedPurchases ? '是' : '否' }}</view>
      </view>
      <view class="mine-infoitem-flex">
        <view class="min-w-40px pr-10rpx">发票类型</view>
        <view>{{ billInfo.invoiceType }}</view>
      </view>
      <view class="mine-infoitem-flex">
        <view class="min-w-40px pr-10rpx">实收税率</view>
        <view>{{ billInfo.actTaxRate }}</view>
      </view>
      <view class="mine-infoitem-flex">
        <view class="min-w-40px pr-10rpx">结算方式</view>
        <view>{{ billInfo.settlementMethod }}</view>
      </view>
      <view class="mine-infoitem-flex">
        <view class="min-w-100px pr-10rpx">开票品名清单</view>
        <view>{{ billInfo.billNameList.length ? billInfo.billNameList.join(',') : '' }}</view>
      </view>
      <view class="mine-infoitem-flex">
        <view class="min-w-40px pr-10rpx">开票税率</view>
        <view>{{ billInfo.billTaxRate }}</view>
      </view>
      <view class="mine-infoitem-flex">
        <view class="min-w-40px pr-10rpx">货币单位</view>
        <view class="max-w-480rpx">{{ billInfo.currency }}</view>
      </view>
      <view class="mine-infoitem-flex">
        <view class="min-w-40px pr-10rpx">备注</view>
        <view>{{ billInfo.notes }}</view>
      </view>
    </view>
    <view class="mine-infoitem-tip pb-50rpx">*如有变动请及时通知到联系人。</view>
  </view>
</template>

<script setup lang="ts">
import { supplierQuerySupplierInfo } from '@/genapi/supplier'

const billInfo = reactive({
  taxNum: '',
  taxIncludedPurchases: '',
  invoiceType: '',
  actTaxRate: '',
  settlementMethod: '',
  billNameList: [],
  billTaxRate: '',
  notes: '',
  currency: '',
})
onMounted(() => {
  getBillInfo()
})

async function getBillInfo() {
  const params = {}
  const { data } = await supplierQuerySupplierInfo(params)
  billInfo.taxNum = data.data.billInfo.taxNum
  billInfo.taxIncludedPurchases = data.data.billInfo.taxIncludedPurchases
  billInfo.invoiceType = data.data.billInfo.invoiceType
  billInfo.actTaxRate = data.data.billInfo.actTaxRate
  billInfo.settlementMethod = data.data.billInfo.settlementMethod
  billInfo.billNameList = data.data.billInfo.billNameList
  billInfo.billTaxRate = data.data.billInfo.billTaxRate
  billInfo.notes = data.data.billInfo.notes
  if (data.data.supplierInfo.currencyList?.length) {
    billInfo.currency = data.data.supplierInfo.currencyList.map(item => item.name).join('、')
  } else {
    billInfo.currency = ''
  }
}
</script>

<style scoped>
.mine-infoitem-page {
  padding: 0 24rpx;
}

.mine-infoitem-content {
  margin-top: 24rpx;
  background-color: #fff;
  border-radius: 16rpx;
}

.mine-infoitem-flex {
  display: flex;
  justify-content: space-between;
  line-height: 108rpx;
  padding-left: 24rpx;
  padding-right: 36rpx;
}

.mine-infoitem-tip {
  font-size: 24rpx;
  color: #999999;
  margin-top: 16rpx;
  padding-left: 24rpx;
  padding-right: 36rpx;
}
</style>
